package org.chen.aao.app.controller;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.chen.aao.common.app.dto.AnalyticsCheckRequest;
import org.chen.aao.common.app.dto.AppVersionCheckRequest;
import org.chen.aao.common.app.dto.AppVersionCheckResponse;
import org.chen.aao.common.response.Result;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

@RestController
@RequestMapping("/analytics")
@RequiredArgsConstructor
@Slf4j
public class AnalyticsController {

    /**
     * 记录事件
     */
    @Schema(name = "记录APP启动事件")
    @PostMapping("/events")
    public Result<?> checkVersion(@Validated @RequestBody AnalyticsCheckRequest request) {
        log.info("Received events: {}", request.getEvents().toString());
        return Result.success();
    }

    /**
     * 记录事件
     */
    @Schema(name = "记录用户事件")
    @PostMapping("/user")
    public Result<?> checkUser(@Validated @RequestBody AnalyticsCheckRequest request) {
        log.info("Received User events: {}", request.toString());
        return Result.success();
    }
}
